GNUH8 v0403

 

 

October 1st, 2004

  

KPIT Cummins Infosystems Limited is now releasing GNUH8 v0403, a cross compiler tool chain for the Renesas (formerly Hitachi) H8 series of micro controllers.

 

SALIENT FEATURES:

  1. GNUH8 v0403 is based on gcc-3.4.2 (snapshot as on 13th August 2004), binutils-2.15 (snapshot as on 17th May 2004) and newlib-1.12.0 (downloaded from CVS on 7th July 2004).

  2. The latest patches have been applied to the gcc, binutils and newlib.

NOTE: GDBH8 v0402 can be used with GNUH8 v0403.

 

Please refer to the FAQ for details of the patches applied to the gcc-3.4 sources.

 

ABOUT GNUH8 v0403: 

 

Release version: GNUH8 v0403
Release Date: 1st October 2004
   
Platforms Supported: Red Hat GNU/Linux v8.0 or later (or compatible distribution)
  Windows 9X/NT/2000/XP/ME
Languages: C, C++
H8 Series: H8/300,
H8/300H,
H8/300H Tiny Series,
H8/S 26XX,
H8/S 2XXX
Object File Formats: ELF, COFF

 

Please register at http://www.kpitgnutools.com for free technical support. 

Please contact http://www.kpitgnutools.com/feedback.php for any feedback or suggestions.

 

CHANGES IN THIS RELEASE:

 

This section summarizes the major changes as compared to GNUH8 v0402.

 

GCC:

 
1

Following code gives error, "mstats.c: undefined reference to `_malloc_stats_r'" in v0402 since malloc_stats was not supported. Support has been added from v0403.

     #include<stdio.h>
     #include<malloc.h>
     int main(void)
     {
       malloc_stats();
       mallinfo();
       return 0;
     }

2 Following code produces Internal Compiler Error for v0402
     template<template<int> class T> struct A : T<0>
     {
       void foo();
       template<template<int> class U> friend void A<U>::foo();
     };
     template<int> struct B {};
     A<B> a;
This has been fixed.
3 Following code gives Internal Compiler Error.
     void bug(char* dst)
     {
       register char* _dst __asm ("er6");
       __asm__ ("eepmov.b":"=g"(*_dst)::"r4","er5","er6");
     }
Instead of ICE, following error is displayed, "error:asm clobber conflict with output operand"
4 Support for long long has been added for H8/300.
5 The "function_vector" attribute is modified so as to take vector address
location as location used for indirect memory addressing jump instruction
like "jsr @aa:8".
This was not present in earlier tool chains.
Use of this attribute will save two bytes per function call but reduces
speed of execution slightly.
Example:
void foo (void) __attribute__ ((function_vector(vector_address)));
void foo (void)
{
}
void bar (void)
{
foo();
}

HEW:

1 Following compiler options are added,
    -ffunction-sections
    -fdata-sections
    -fomit-frame-pointer
  Following linker option is added,
    --gc-sections
  Checkbox for KEEP is added in options->linker->sections-><section name>->Advanced similar to checkbox for NOLOAD.
  Disable "NOLOAD" if "KEEP" is checked and vice versa. Checkbox "KEEP" is by default checked for .vects section and for any other section, both checkboxes are in not checked position.
   
  The linker option "--gc-sections" will be ignored by COFF tool chain. Garbage collection will not be done in COFF tool chain. So, in case of COFF tool chain, linker option "--gc-sections" is grayed out in not selected position.
   
  Linker sections are modified like following,
In .text section .text.* is added before etext
In .data section .data.* is added before _edata
   
  Compiler options "-fdata-sections", "-ffunction-sections" along with linker option "--gc-sections" will optimize code by removing unused variables and functions.
  Due to above additions, HEW project created using v0403 GNUH8 tool chain cannot be built successfully using GNUH8 v0402 and lower versions of tool chain.
2 HEAP memory control function "sbrk()", low level read/write functions "_read()" & "_write()" are added in HEW sample projects for GNUH8 tool chain. Programmer has to modify target hardware related calls and use above mentioned functionality on target. These low level read/write functions are useful in case of redirecting "stdin"/"stdout" to serial port, LCD etc.
3 Macros DEBUG and RELEASE are added in HEW DLL in respective sessions. Call to library routine "_exit()" is done depending on those macros. The function is only called in Debug mode. This will reduce code size in Release mode by not including un-necessary _exit routine and few byte of program meory are saved.

Samples:

1 Samples of EDK2215 and EDK3069 for HEAP memory control and low level read/write are added.
2 XMK-OS is ported for EVB2623. OS source code, samples with application and readme file are included.
3 File start.S is modified such that call to library routine "_exit()" is made depending on macro DEBUG and RELEASE.
4 Macro DEBUG is added for debug mode RAM application and RELEASE is added for release mode ROM application in makefile of samples.

Documentation:

Application Note on Optimization options of compiler

1 This note mentions about compiler behavior for various code snippets when compiled with optimization options. It also states workaround options to get expected behavior from code snippets.
 

Renesas-GNUH8 Migration Guide

1 Assembler directive .align is added which is compatible with .ALIGN Renesas directive.
2 Following intrinsic functions are modified, dadd(), dsub(), mac(), rotlw()
   

IAR-GNUH8 Migration Guide

1 Following intrinsic functions are modified, dadd(), dsub(), mac(), rotlw()

Known Problems:

H8-COFF and H8-ELF:

1 Windows 9X has restriction on the length of command line that can be given. Due to this,
 

1. When the tool chain shortcut from 'Start' menu is invoked, the relevant batch file may not be found and Windows 9X may display an error.

  2. In HEW (High-performance Embedded Workshop), this restriction may cause problems during linking.
   
 

Please refer to the following link for further details on this.
http://www.kpitgnutools.com/phpmyfaq/index.php?sid=2884&aktion=artikel&rubrik=001006&id=151&lang=en

2 Following code gives warning "will never be executed" for " return (val);" statement in "Factorial" function with "-O2" and "-Wunreachable-code" command line options.
   float foo (float X)
   {
     float val = 1.0;
     int k,j;
     for (k=1; k < 5; k++)
     {
      val += 1.0;
     }
     return (val);
   }
  This can be avoided by using volatile variable in the "foo" function.
3 GNUH8 assembler does not generate error or warning message when immediate data in the HEX format is given with H' as prefix. For example,
    mov #H'0f,rl0
4 Following code if compiled for H8300H, H8300HN, H8S, H8300SN targets with optimization option -O2 and above, generates wrong assembly code,
   unsigned int ReadWordx86Style(unsigned long lAddr)
   {
      unsigned char baBuff[2];
      baBuff[0x00]=*((unsigned char *)((unsigned int)(lAddr+1)));
      baBuff[0x01]=*((unsigned char *)((unsigned int)(lAddr+0)));
      return((*(unsigned int *)baBuff));
   }
   int start(void)
   {
     unsigned char baBuff[256];
     unsigned int wResult;
     wResult = ReadWordx86Style((unsigned long)((unsigned int)baBuff));
     return(wResult);
   }
  Workaround is to pass an option -fno-expensive-optimizations along with -O2.
5 Following code produces Internal Compiler Error,
    void set_bit(int nr, char * addr)
    {
      __asm__("bset %w1,%0"
     :"=m"(*addr)
     :"g"(nr),"m"(*addr));
    }

H8-COFF:

1 Following code gives error "Too many new sections; can't add ".bss.w35"" when compiled with -fdata-sections option, unsigned int w00,w01,w02,w03,w04,w05,w06,w07,w08,w09,w10,w11,w12,w13,w14,w15,w16,w17,w18,w19,w20,w21,w22,w23,w24,w25,w26,w27,
w28,w29,w30,w31,w32, w33,w34,w35,w36,w37,w38,w39;
     int main(void)
     { }
  Change in variable name from w?? to ww?? removes error.

H8-ELF:

1 Following C++ code produces Internal Compiler Error if -O1 is passed with -g option,
     namespace N
     {
       int foo();
       struct A
        {
          A();
          ~A() { if (foo()) foo(); }
        };
       struct B : A {};
       struct C : B {};
       struct D : C {};
       struct E
        {
          D d1, d2;
        };
       inline E bar1()
       {
         E bar2 (const E&);
         E e;
         return bar2(E());
       }
       E e=bar1();
     }

NOTE:

1 The int32 libraries for H8/300 are not provided with this release.